import store from "@/store";
import dayjs from 'dayjs';
export const formItemStyle = {
  paddingLeft: "20px",
};

export const cellStyle = {
  background: "rgba(28, 155, 252, 0.02)",
  color: "rgb(142, 155, 185)",
  textAlign: "center",
};

// 表头单元格样式
export const headerCellStyle = {
  background: "rgba(28, 155, 252, 0.02)",
  color: "rgb(142, 155, 185)",
  textAlign: "center",
};

// 表格内表单子样式
export const tableFormStyle = {
  marginBottom: 0,
};
export const formBase = [
  {
    label: "车辆编号",
    type: "input",
    field: "vehicleNo",
    required: true,
  },
  {
    label: "外联编号",
    type: "input",
    field: "externalTrackingNo",
    required: true,
  },
  {
    label: "清关单号",
    type: "input",
    field: "shippingNo",
    required: true,
  },
  {
    label: '复核时间',
    type: 'daterange',
    field: 'shelfTime',
    required: true,
    otherOptions: {
      disabled: false,
      rangeSeparator: '至',
      startPlaceholder: '开始日期',
      endPlaceholder: '结束日期',
      pickerOptions: {
        shortcuts: [ {
          text: "今天",
          onClick(picker) {
            const end = dayjs().format("YYYY-MM-DD 23:59:59");
            const start = dayjs().format("YYYY-MM-DD 00:00:00");
            picker.$emit("pick", [start, end]);
          },
        },
        {
          text: "昨天",
          onClick(picker) {
            const end = new Date(dayjs().format("YYYY-MM-DD 23:59:59"));
            const start = new Date(dayjs().format("YYYY-MM-DD 00:00:00"));
            end.setTime(start.getTime() - 3600 * 1000 * 24);
            start.setTime(start.getTime() - 3600 * 1000 * 24);
            picker.$emit("pick", [start, end]);
          },
        },
        {
          text: "最近三天",
          onClick(picker) {
            const end = new Date(dayjs().format("YYYY-MM-DD 23:59:59"));
            const start = new Date(dayjs().format("YYYY-MM-DD 00:00:00"));
            start.setTime(start.getTime() - 3600 * 1000 * 24 * 3);
            picker.$emit("pick", [start, end]);
          },
        },
        {
          text: "最近一周",
          onClick(picker) {
            const end = new Date(dayjs().format("YYYY-MM-DD 23:59:59"));
            const start = new Date(dayjs().format("YYYY-MM-DD 00:00:00"));
            start.setTime(start.getTime() - 3600 * 1000 * 24 * 7);
            picker.$emit("pick", [start, end]);
          },
        },
        {
          text: "最近一个月",
          onClick(picker) {
            const end = new Date(dayjs().format("YYYY-MM-DD 23:59:59"));
            const start = new Date(dayjs().format("YYYY-MM-DD 00:00:00"));
            start.setTime(start.getTime() - 3600 * 1000 * 24 * 30);
            picker.$emit("pick", [start, end]);
          },
        },]
      }
    }
  }, 
  {
    label: '扫描仓库',
    type: 'select',
    required: true,
    field: 'warehouseId',
    optionsKey: 'warehouseName',
    optionsValue: 'id',
    options: store.state.custom_dict.warehouse,
  },
  {
    label: "扫描人员",
    type: "select",
    required: true,
    field: "scanner",
    optionsKey: "scanner",
    optionsValue: "userId",
    options:  []
  }, 
];

export const tableBase = [
  {
    label: "扫描时间",
    prop: "scanTime", 
    width: "200",
    operate: {
      type: "input",
      field: "scanTime",
    },
  },
  {
    label: "清关单号",
    prop: "shippingNo",
    width: 150,
    operate: {
      type: "input",
      field: "shippingNo",
    },
  },
  {
    label: "件数",
    prop: "pieces",
    width: 150,
    operate: {
      type: "input",
      field: "pieces",
    },
  },
  {
    label: "实际重",
    prop: "actualWeight", 
    width: 150,
    operate: {
      type: "input",
      field: "scanactualWeightTime",
    },
  },
  {
    label: "核算重",
    prop: "recheckWeight", 
    width: 150,
    operate: {
      type: "input",
      field: "recheckWeight",
    },
  },
  {
    label: "扫描仓",
    prop: "scanStore",
    width: 200,
    operate: {
      type: "input",
      field: "scanStore",
    },
  },
  {
    label: "扫描员",
    prop: "scanName",
    width: 200,
    operate: {
      type: "input",
      field: "scanName",
    },
  },
  {
    label: "车辆编号",
    prop: "vehicleNo",
    width: 200,
    operate: {
      type: "input",
      field: "vehicleNo",
    },
  }, 
  {
    label: "航空公司",
    prop: "AirLineCompany",
    width: 150,
    operate: {
      type: "select",
      field: "companyId",
      optionsKey: "airLineCompany",
      optionsValue: "id",
      options: store.state.custom_dict.company,
      rules: /^[a-zA-Z0-9]{1,20}$/,
    },
  },
  {
    label: "备注",
    prop: "remarks", 
    width: 150,
    operate: {
      type: "input",
      field: "remarks",
    },
  }, 
];
